﻿using Abp.Domain.Repositories;
using Aug.iot.People;
using AutoMapper;
using System;
using System.Collections.Generic;
using System.Text;

namespace Aug.iot.Tasks.Dtos
{
    public class TaskMapProfile: Profile
    {
        public TaskMapProfile()
        {
            CreateMap<TaskDto, Task>();

            CreateMap<CreateTaskDto, Task>();
            CreateMap<Task, TaskDto>().AfterMap((src, dest) =>
            {
                if(src.AssignedPerson != null)
                {
                    dest.AssignedPersonName = src.AssignedPerson.Name;
                }

            });

        }
    }
}
